package com.xxxx.server.controller;


import com.xxxx.server.pojo.Position;
import com.xxxx.server.pojo.RespBean;
import com.xxxx.server.service.IPositionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhoubin
 */
@Api("职位管理")
@RestController
@RequestMapping("/system/basic/pos")
public class PositionController {

    @Autowired
    private IPositionService iPositionService;

    @ApiOperation(value = "查询所有职位")
    @GetMapping("/")
    public List<Position> selectAllPosition(){
        return iPositionService.selectAllPosition();
    }


    @ApiOperation(value = "添加职位")
    @PostMapping("/")
    public RespBean addPosition(@RequestBody Position position){
        return iPositionService.addPosition(position);
    }

    @ApiOperation(value = "批量删除职位")
    @DeleteMapping("/")
    public RespBean deletePositions(@RequestParam List<Integer> ids){
        return iPositionService.deletePositions(ids);
    }


    @ApiOperation(value = "删除职位")
    @DeleteMapping("/{id}")
    public RespBean deletePosition(@PathVariable Integer id){
        return iPositionService.deletePosition(id);
    }

    @ApiOperation(value = "修改职位信息")
    @PutMapping("/")
    public RespBean updatePositionInfo(@RequestBody Position position){
        return iPositionService.updatePositionInfo(position);
    }
}
